RDKEMW-17624: Fixed potential causes of plugin crash#303
Merged
Conversation
Reason for Change: Fixed potential causes of plugin crash Test Procedure: Monitor for networkmanager plugin crash Priority: P1 Risks: Medium Signed-off-by: Gururaaja ESR<Gururaja_ErodeSriranganRamlingham@comcast.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses potential NetworkManager plugin crashes by improving thread-safety around default-interface handling, adding defensive nullptr checks around iterator creation, and tightening GLib/libnm lifecycle management to avoid cross-thread GObject mutation.
Changes:
- Protect default-interface state with a mutex and route reads/writes through
getDefaultInterface()/setDefaultInterface(). - Add
platform_deinit()and invoke it during shutdown to release platform-specific resources (notably libnm/GLib objects on GNOME). - Add nullptr checks after RPC iterator creation to avoid dereferencing invalid iterators.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/l2Test/libnm/l2_test_libnmproxy.cpp | Fixes a gmock expectation chain / minor formatting cleanup. |
| plugin/rdk/NetworkManagerRDKProxy.cpp | Uses locked default-interface accessors; adds iterator nullptr checks; adds platform_deinit(). |
| plugin/gnome/gdbus/NetworkManagerGdbusProxy.cpp | Uses locked default-interface accessors; adds iterator nullptr checks; adds platform_deinit(). |
| plugin/gnome/NetworkManagerGnomeWIFI.cpp | Improves error handling/cleanup in WPS flow; adds scan error handling. |
| plugin/gnome/NetworkManagerGnomeProxy.cpp | Replaces global NMClient with instance state; isolates libnm client on a private GMainContext; adds cleanup in platform_deinit() and iterator nullptr checks. |
| plugin/NetworkManagerJsonRpc.cpp | Adds nullptr checks for created iterators before invoking backend APIs. |
| plugin/NetworkManagerImplementation.h | Introduces mutex-protected default-interface getters/setters; adds forward decls for libnm/GLib types; adds platform_deinit() declaration. |
| plugin/NetworkManagerImplementation.cpp | Calls platform_deinit() on shutdown; uses default-interface accessors; adds iterator nullptr checks. |
| plugin/NetworkManagerConnectivity.cpp | Switches default-interface access to mutex-protected accessor and refactors connectivity-check branching for consistency. |
| legacy/LegacyWiFiManagerAPIs.cpp | Adds nullptr checks for created iterators. |
| legacy/LegacyNetworkAPIs.cpp | Adds nullptr checks for created iterators. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bpunnuru
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for Change: Fixed potential causes of plugin crash
Test Procedure: Monitor for networkmanager plugin crash
Priority: P1
Risks: Medium